/**
 * @Name: HW_4-1.css
 * @Description: 纯css实现tabs切换功能
 * @Author: 李瑞豪
 * @Modify: 剔除過多ID，變量語義化
 * @Update: 2019-09-05 10:18
 */

/* common style */
.box-showdow{
  border: 2px solid #777;
  border-radius: 5px;
  box-shadow: 10px 10px 5px #888;
}
li{
  list-style: none;
}
a{
  color: #000;
  text-decoration: none;
}

/* header style */
/**
 * header: #logo,nav
 */
header{
  box-sizing: border-box;
  width: 1000px;
  height: 170px;
  margin: 20px auto;
  background: url(../images/HW_4-1/welcome.png);
  background-size: cover;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
}
.logo-img{
  width: 276px;
  height: 100%;
  border-radius: 5px 0 0 5px;
  border-right: 2px solid #777;
}
nav{
  position: relative;
  left: 145px;
  top: 120px;
  font-size: 18px;
}
.menu{
  height: 30px;
  line-height: 30px;
  width: 100%;
}
.menu > li{
  float: left;
  margin-left: 20px;
}
.menu li > a:hover, .menu li > a:active{
  color: #f65219;
}
.sub-menu > ul{
  position: relative;
  background: #dae8ca;
  padding-left: 0;
  width: auto;
  height: 90px;
  border: 1px solid #000;
  border-radius: 0 0 5px 5px;
  border-top: none;
  display: none;
  z-index: 99;
}
.sub-menu:hover > ul{
  display: block;
}
.sub-menu li:not(:last-child){
  border-bottom: 1px solid #000;
}
.sub-menu li > a{
  margin-left: 20px;
}
.sub-menu a:hover, a:active{
  color: #FF0A00;
}

/* main style */
/**
 * main: aside,#product-list
 * #product-list: .tab-content,.tab-menu
 */
main{
  box-sizing: border-box;
  width: 1000px;
  height: 450px;
  margin: 20px auto;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}
aside{
  box-sizing: border-box;
  width: 280px;
  background: #4a4a4c;
}
aside > h1{
  text-align: center;
  line-height: 70px;
  color: #fff;
}
.home-img{
  width: 100%;
  height: 230px;
}
aside > p{
  font-size: 12px;
  text-align: center;
  margin-top: 70px; 
}
.product-list{
  width: calc(100% - 300px);
  position:relative;
}
.tab-menu {
  position: absolute;
  margin: 0;
  padding: 0;
}
.tab-menu li{
  display:inline-block;
  margin: 0;
  padding: 0;
}
.tab-menu li a{
  display: block;
  font-weight: bold;
  line-height: 30px;
  text-align: center;
  width: 90px;
  height: 30px;
  margin-left: 15px;
  border: 2px solid #777;
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  background: #54686e;
  color: #fff;
}
.tab-menu li:first-child a{
  margin-left: 0px;
  /*margin-left: 20px;*/
}
.tab-menu li a:hover{
  background: #adcca3;
  color: #000;
}
.tab-content{
  position: absolute;
  top: 30px;
  box-sizing: border-box;
  width: 100%;
  height: calc(100% - 30px);
  background: #d2e6c1;
  border: 2px solid #777;
  border-radius: 0 0 5px 5px;
  display: none;
}
#tab-hot,#tab-model:target,#tab-decoration:target,#tab-pet:target,#tab-others:target,#tab-skin:target{
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  flex-wrap: wrap;
  align-items: flex-start;
}
div .tab-menu li:first-child a{
  background: #d2e6c1;
  color: #000;
}
/* 目标被呼叫目标变色 */
#tab-hot:target ~ div li:nth-child(1) a,
#tab-model:target ~ div li:nth-child(2) a,
#tab-decoration:target ~ div li:nth-child(3) a,
#tab-pet:target ~ div li:nth-child(4) a,
#tab-others:target ~ div li:nth-child(5) a,
#tab-skin:target ~ div li:nth-child(6) a{
  background: #d2e6c1;
  color: #000;
}
/* 目标被呼叫且tab-hot不被靠近是tab-hot变色 */
#tab-model:target ~ div li:first-child:not(:hover) a,
#tab-decoration:target ~ div li:first-child:not(:hover) a,
#tab-pet:target ~ div li:first-child:not(:hover) a,
#tab-others:target ~ div li:first-child:not(:hover) a,
#tab-skin:target ~ div li:first-child:not(:hover) a{
  background: #54686e;
  color: #fff;
}
/* 目标被呼叫且tab-hot被靠近是tab-hot变色 */
#tab-model:target ~ div li:first-child:hover a,
#tab-decoration:target ~ div li:first-child:hover a,
#tab-pet:target ~ div li:first-child:hover a,
#tab-others:target ~ div li:first-child:hover a,
#tab-skin:target ~ div li:first-child:hover a{
  background: #adcca3;
  color: #000;
}
.item-space{
  position: relative;
  margin-top: 15px;
  width: 45%;
  height: 35%;
  border: none;
}
.item{
  position: relative;
  margin-top: 25px;
  width: 45%;
  height: 35%;
  border: 2px solid #eee;
  border-radius: 10px;
  box-shadow: 8px 8px 5px #888;
  background: #dae8ca;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-around;
}
.item:hover{
  transform: scale(1.01);
  z-index: 1;
}
.item:hover .item-desc{
  display: block;
}
.item-desc{
  position: absolute;
  bottom: 90%;
  width: 100%;
  height: 70%;
  background: #000;
  opacity: 0.7;
  color: #fff;
  border: none;
  border-radius: 10px 10px 10px 0;
  text-align: center;
  box-sizing: border-box;
  padding: 5px 10px;
  display: none;
}
.item-desc > h3,.item-desc > p{
  margin: 0;
}
.item-img{
  width: 36%;
  height: 80%;
  border-radius: 10px;
}
.item-price{
  color: red;
}
.item-detail{
  text-align: right;
  width: 50%;
  height: 80%;
}
.item-detail > h3{
  text-align: left;
  margin: 5px 0;
}
.btn button{
  background: #e9540b;
  border-radius: 5px;
  border: 1px solid #eee;
  color: #fff;
  padding: 5px 10px;
  text-align: center;
  cursor: pointer;
  outline: none;
}
.btn button:hover{
  background: #fff;
  color: #000;
  border: 1px solid #777;
}